#include<stdio.h>
#include<stdlib.h>
#include"str_to_int.h"
#include"week_diff.h"




void week_diff(int dy,int dm,int m2)
{
	if((year % 4 == 0 && year % 100 != 0)||(year % 100 == 0 && year % 400 == 0))
	{
		m2 = 1;//说明该年为闰年
	}
	else
	{
		m2 = 0;//说明不是闰年
	}
	if(year == 2000)
	{
		dy = 0;
		m2 = 1;
		goto yue_12;
	}
	yue_12:
		switch(month)
			{
				case 1:dm = 0;month = 31;break;
				case 2:dm = 3;month = d == 1?29:28;break;
				case 3:dm = 3+m2;month = 31;break;
				case 4:dm = 6+m2;month = 30;break;
				case 5:dm = 1+m2;month = 31;break;
				case 6:dm = 4+m2;month = 30;break;
				case 7:dm = 6+m2;month = 31;break;
				case 8:dm = 2+m2;month = 31;break;
				case 9:dm = 5+m2;month = 30;break;
				case 10:dm = m2;month = 31;break;
				case 11:dm = 3+m2;month = 30;break;
				case 12:dm = 5+m2;month = 31;break;
			}
	else if(year > 2000)
	{
		d = (year -1-2000)/4-(year -1 -2000)/100+(year-1-2000)/400+1;
	}
	else if
	{
		d = (year -2000)/4-(year -2000)/100+(year-2000)/400;
	}
	dy = (year -2000) + d;//该年1月1号到2000年1月1日的星期差
}